package com.zhiche.lisa.lspm.service.fleet;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.zhiche.lisa.lspm.dao.model.fleet.Fleet;
import com.zhiche.lisa.lspm.dto.ArFundDTO;
import com.zhiche.lisa.lspm.vo.fleet.FleetCarId;
import com.zhiche.lisa.lspm.vo.fleet.FleetLineVO;
import com.zhiche.lisa.lspm.vo.fleet.FleetManagementListVO;
import com.zhiche.lisa.lspm.vo.fleet.FleetVo;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * <p>
 * 车队 服务类
 * </p>
 *
 * @author qichao
 * @since 2018-07-18
 */
public interface IFleetService extends IService<Fleet> {
    /**
     * 分页查询公司车队
     */
    Page<FleetLineVO> fleetLinePage(Page<FleetLineVO> page, String authorization);

    /**
     * 分页查询承运商车队
     */
    Page<FleetLineVO> lspFleetLinePage(Page<FleetLineVO> page, String authorization);

    /**
     * 新增车队
     */
    void insertFleet(Fleet fleetLine, String authorization);

    /**
     * 修改车队信息
     */
    Fleet updateFleet(Fleet fleetLine,String authorization);

    /**
     * 删除车队
     */
    List<String> deleteFleet(List<Long> ids);

    /**
     * 车队批量新增车辆
     */
    void insertFleetBing(FleetLineVO fleetLineVO, String authorization);

    /**
     * 车队批量删除车辆
     */
    void deleteFleetBing(FleetLineVO fleetLineVO);

    /**
     * 获取车队信息
     * @param condition
     * @return
     */
    List<Fleet> selectFleetList(Map<String,Object> condition);
    /**
     * 查询车队
     */
    List<FleetLineVO> queryFleetBindList(Wrapper<FleetLineVO> ew);


    /**
     * 车队推otm
     */
    String fleetToOtm(Long id, String authorization);
    /**
     * 根据车队名称获取车队信息
     * @param arFundDTOS
     * @return
     */
   Map<Long,Fleet> queryFleetByName(List<ArFundDTO> arFundDTOS);

    /**
     * 批量获取车队信息
     * @param fleet
     * @return
     */
    List<Fleet> getFleetAll(List<Fleet> fleet);
    /**
     * 无tenant 查询车队
     *
     */
    Fleet selectByIdNoTenant(Long fleetId);


    /**
     * 车俩所属车队列表
     */
    Page<FleetManagementListVO> FleetManagementList(Page<FleetManagementListVO> page, String authorization);

    List<Fleet> selectListNoTenant(EntityWrapper<Fleet> fEW);

    Fleet getOneFleet(Fleet fleet);

    /**
     * 根据牵引车ID或者挂车ID查询车队信息
     * 老查法未用resource_type进行区分
     * @param carrierId 牵引车ID
     * @param trailerId 挂车ID
     * @return FleetCarId
     */
    List<FleetCarId> getOldFleetByCarrierIdOrTrailerIdNoTenant(Long carrierId, Long trailerId);

    /**
     * 根据牵引车ID或者挂车ID查询车队信息
     * 新查法使用resource_type进行区分
     * @param carrierId 牵引车ID
     * @param trailerId 挂车ID
     * @return FleetCarId
     */
    FleetCarId getNewFleetByCarrierIdOrTrailerIdNoTenant(Long carrierId, Long trailerId);

    /**
     * 根据车队ID查询车队附件信息
     * @param id 车队ID
     * @return Fleet
     */
    Fleet getFleetAttach(Long id);

    /**
     * 根据车队ID查询车队及其银行信息
     * @param ids 车队ID集合
     * @return Fleet
     */
    List<Fleet> selectFleetByIds(List<Long> ids);

    /**
     * 根据图片key获取下载路径
     * */
    Map<String, Object> getAttachPatch(String key);

    /**

     *  根据资源ID和类型查询车队信息
     * @param id 资源ID
     * @param type 资源类型
     * @return Fleet
     */
    Fleet selectByResourceIdAndType(String type,Long id);

    /**
     * 推送车队到erp和OTM
     */
    void fleetToErpAndOtm(Fleet fleet, String authorization);

    FleetLineVO queryFleetBasic(Map<String, String> condition);

    /**
     * 根据承运商手机获取公司车队列表
     * @param mobile
     * @return
     */
    List<Fleet> selectFleetListByLspMobile(String mobile);

    /**
     * 根据车队名查询车队联系人
     * @param fleetName
     * @return
     */
    Map<String, Object> queryPersonalByFleetName(String fleetName);

    /**
     * 根据车队名查询车队
     * @param fleetName
     * @return
     */
    List<Fleet> queryByFleetName(String fleetName);

    String disableFleet(FleetVo condition, String authorization);

    String enableFleet(FleetVo condition, String authorization);

    Page<FleetVo> lspFleetList(Page<Map<String, Objects>> page, String authorization);

    List<Fleet> selectFleetListByMobile(String tenantId);
}

